<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.commons.Constants" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/lotCorrection.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<script language="javascript">

    function loadProducts()
    {
        var form = document.lotChangeForm;
	    if( form.processType.value == '0' )
        {
            form.action="<%=chipTracContext%>/lotChange.do";
	        form.submit();
            return ;
        }
        else
        {
	        form.action="<%=chipTracContext%>/lotChange.do?action=loadProducts";
	        form.submit();
        }
    }

    function loadLocations()
    {
        var form = document.lotChangeForm;
        if( form.processStepId.value == '0' || form.processStepId.value == '-1' || form.processStepId.value == '-2' )
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=loadProducts";
            form.submit();
            return ;
        }
        else
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=loadLocations";
            form.submit();
        }
    }

    function loadLotNumbers()
    {
        var form = document.lotChangeForm;
        if( form.locationId.value == '0' )
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=loadLocations";
            form.submit();
            return ;
        }
        else
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=loadLotNumbers";
            form.submit();
        }
    }

    function loadLot()
    {
        var form = document.lotChangeForm;

        if( form.lotId.value == '0' )
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=loadLotNumbers";
            form.submit();
            return ;
        }
        else
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=loadLot";
            form.submit();
        }
    }

    function save()
    {
        var form = document.lotChangeForm;
        var type = form.type.value;
        var errorMsg = "";
        var error  = document.getElementById( "message" );

        if( type == 'location' )
        {
            if( form.newLocationId.value == 0 )
            {
                errorMsg = "Please select the new location to move the Lot";
            }
        }
        else if( type == 'product' )
        {
            if( form.newProcessStepId.value == 0 )
            {
                errorMsg = "Please select the new product to move the Lot";
            }
        }

        if( errorMsg.length > 0 )
        {
            error.innerHTML		= errorMsg ;
        }
        else
        {
            form.action="<%=chipTracContext%>/lotChange.do?action=saveLot";
            form.submit();
        }
    }

    function showLotInformation()
    {
        var type =  document.lotChangeForm.type.value;
        newWindow = window.open ('<%=chipTracContext%>/lotChange.do?action=allLotInfo&type='+type,'optionsPopup1','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=500,height=450,resizable=no');
        newWindow.focus();
    }

</script>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<!--TBODY-->
<TR>
<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/operations/dataentryMenu.jsp" %>

<!-- end of the side navigations -->

<TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8/></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2/></TD>
<TD valign="top" width="100%">
<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0/>
<BR>

<!-- from here your body starts -->
<html:form name="lotChangeForm"  type="com.scalar.chiptrack.operations.dataentry.lotcorrection.forms.LotChangeForm" action="/lotChange">
<table border="0" width="90%" align=center>
	<%
		String type = (String)request.getAttribute( "type" );
	%>
    <tr><td colspan=5 class="NArialW" align="center">Change Lot
	<%
		if( type != null && type.equalsIgnoreCase( "location" ) )
		{
			out.print( "Location" );
		}
		else if( type != null && type.equalsIgnoreCase( "product" ) )
		{
			out.print( "Product" );
		}
	%>
	</td></tr>
    <tr><td colspan=5>&nbsp;</td></tr>
    <tr><td colspan=5 class='NArialL'><strong><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></td></tr>
    <tr>
        <td colspan=5>&nbsp;
            <chiptrack:info styleClass="NArialL" />
            <chiptrack:errors styleClass="NArialL" />
            <chiptrack:messages type="info" styleClass="NArialL" />
        </td>
    </tr>
    <logic:equal name="showMessage" value="TRUE">
        <tr>
            <td colspan=5 align='left'>
                <font class='NArialS' color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font>
            </td>
        </tr>
    </logic:equal>
    <tr><td colspan=5>&nbsp;</td></tr>
    <tr>
        <td>
            <table border="0" width="100%">

				<input type="hidden" name="type" value="<%=type%>" >
                <tr>
					<td width="20%"><font class="NArialL">Select Process Type:</font></td>
                    <td width="25%">
                        <p>
                        <font class="NArialL">
                        <html:select property="processType"  styleClass="txfield" onchange="javascript:loadProducts();" >
                            <html:option value="0">Select Process Type</html:option>
                            <html:options collection="processList" property="value" labelProperty="label"/>
                        </html:select>
                        </font>
                        </p>
                    </td>
                    <logic:present name="productList" >
                        <td width="20%"><font class="NArialL">Select Product Name:</font></td>
                        <td width="20%" align=left>
                            <font class="NArialL">
	                            <html:select property="processStepId"  styleClass="txfield" onchange="loadLocations()"  >
	                               <html:option value="0">Select Part Number</html:option>
                                    <html:options collection="productList" property="value" labelProperty="label"/>
                                </html:select>
                            </font>
                        </td>
                    </logic:present>
                    <logic:notPresent name="productList">
                        <td width="40%" colspan="2"/>
                    </logic:notPresent>
                </tr>

                <tr>
                    <logic:present name="locationsList" >
                        <td width="20%"><font class="NArialL">Select Location:</font></td>
                        <td width="25%">
                            <p>
                            <font class="NArialL">
                            <html:select property="locationId"  styleClass="txfield" onchange="loadLotNumbers()"  >
                                <html:option value="0">Select Location</html:option>
                                <html:options collection="locationsList" property="value" labelProperty="label"/>
                            </html:select>
                            </font>
                            </p>
                        </td>
                    </logic:present>
                    <logic:notPresent name="locationsList">
                        <td width="40%" colspan="2"/>
                    </logic:notPresent>
                    <logic:present name="lotNumbersList" >
                        <td width="20%"><font class="NArialL">Select Lot:</font></td>
                        <td width="25%">
                            <p>
                            <font class="NArialL">
                            <html:select property="lotId"  styleClass="txfield" onchange="loadLot()"  >
                                <html:option value="0">Select Lot</html:option>
                                <html:options collection="lotNumbersList" property="value" labelProperty="label"/>
                            </html:select>
                            </font>
                            </p>
                        </td>
                    </logic:present>
                    <logic:notPresent name="lotNumbersList">
                        <td width="40%" colspan="2"/>
                    </logic:notPresent>
                </tr>
				<logic:present name="LotInfo">
				<tr>
					<td><font class="NArialL">
                        <nested:equal property="processType" value="Fab">
                          Wafer Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="Wafer Store">
                           Wafer Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="Fab Option">
                            Wafer Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="Die Bank">
                            Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="FpO">
                            Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="FT">
                            Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="Tape">
                            Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="Assembly">
                            Quantity In
                        </nested:equal>
                        <nested:equal property="processType" value="FG">
                            Quantity In
                        </nested:equal>
                    </font></td>
					<td>
                        <nested:equal property="processType" value="Fab">
                            <html:text name="LotInfo" property="waferQtyIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="Wafer Store">
                            <html:text name="LotInfo" property="waferQtyIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="Fab Option">
                            <html:text name="LotInfo" property="waferQtyIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="Die Bank">
                        <html:text name="LotInfo" property="quantityIn" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                        <nested:equal property="processType" value="FPO">
                            <html:text name="LotInfo" property="quantityIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="FT">
                            <html:text name="LotInfo" property="quantityIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="Tape">
                            <html:text name="LotInfo" property="quantityIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="Assembly">
                            <html:text name="LotInfo" property="quantityIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
                        <nested:equal property="processType" value="FG">
                            <html:text name="LotInfo" property="quantityIn" styleClass="valuetxfield" size="16" disabled="true"/>
                        </nested:equal>
					</td>
					<td><font class="NArialL">
						Date In:
					</font></td>
					<td>
						<html:text name="LotInfo" property="dateIn" styleClass="valuetxfield" size="16" disabled="true"/>
					</td>
				</tr>
				<tr>
                    <td><font class="NArialL">
                        <nested:equal property="processType" value="Fab">
                          Wafer Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="Wafer Store">
                           Wafer Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="Fab Option">
                            Wafer Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="Die Bank">
                            Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="FPO">
                            Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="FT">
                            Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="Tape">
                            Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="Assembly">
                            Quantity Out:
                        </nested:equal>
                        <nested:equal property="processType" value="FG">
                            Quantity Out:
                        </nested:equal>
                    </font></td>
					<td>
                    <nested:equal property="processType" value="Fab">
                        <html:text name="LotInfo" property="waferQtyOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="Wafer Store">
                        <html:text name="LotInfo" property="waferQtyOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="Fab Option">
                        <html:text name="LotInfo" property="waferQtyOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="Die Bank">
                        <html:text name="LotInfo" property="quantityOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="FPO">
                        <html:text name="LotInfo" property="quantityOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="FT">
                        <html:text name="LotInfo" property="quantityOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="Tape">
                        <html:text name="LotInfo" property="quantityOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="Assembly">
                        <html:text name="LotInfo" property="quantityOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>
                    <nested:equal property="processType" value="FG">
                        <html:text name="LotInfo" property="quantityOut" styleClass="valuetxfield" size="16" disabled="true"/>
                    </nested:equal>

                    </td>
					<td><font class="NArialL">
						Date Out:
					</font></td>
					<td>
						<html:text name="LotInfo" property="dateOut" styleClass="valuetxfield" size="16" disabled="true"/>
					</td>
				</tr>
				<tr>
					<td><font class="NArialL">
						Status:
					</font></td>
					<td>
						<html:text name="LotInfo" property="lotStatus" styleClass="valuetxfield" size="16" disabled="true"/>
					</td>
					<td colspan=2>&nbsp;</td>
				</tr>

				<tr>
					<td colspan=4>&nbsp;</td>
				</tr>
				<logic:notPresent name="error" scope="request">
				<%
				if( type != null && type.equalsIgnoreCase( "location" ) )
				{
				%>
				<tr>
					<td>
						<font class="NArialL">New Location:</font>
					</td>
					<td>
						<html:select property="newLocationId" styleClass="txfield">
							<html:option value="0">Select Location</html:option>
							<html:options collection="newLocationList" property="value" labelProperty="label"/>
						</html:select>
					</td>
					<td colspan="2">
					</td>
				<tr>
				<%
				}
				else
				{
				%>
				<tr>
					<td>
						<font class="NArialL">New Product:</font>
					</td>
					<td>
						<html:select property="newProcessStepId" styleClass="txfield">
							<html:option value="0">Select Part Number</html:option>
							<html:options collection="newProductList" property="value" labelProperty="label"/>
						</html:select>
					</td>
					<td colspan="2">
					</td>
				<tr>
				<%
				}
				%>
				<%--<logic:equal name="lotChangeForm" property="prevLotExists" value="true">
				<tr><td colspan="4"><font class="NArialL">&nbsp;</font></td></tr>
				<tr><td colspan="4"><font class="NArialL">Existing Lot Information at the Location: &nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
                <font class="NArialL"><a styleClass="leftsection" href="javascript:showLotInformation()"
                        onmouseover="window.status='Click to show All Lot info';return true" onmouseout="window.status='';return true">Click here</a>
                        &nbsp;to view Lot History</font> </td></tr>
				<tr><td colspan="4"><font class="NArialL">&nbsp;</font></td></tr>
				<tr>
					 <td width="20%"><font class="NArialL">Existing Qty In:</font></td>
					 <td width="25%"><p><font class="NArialL">
						<html:text name="lotChangeForm" property="prevQtyIn" styleClass="valuetxfield" size="20" disabled="true"/>
					 </font></p></td>
					 <td width="20%"><font class="NArialL">Existing Date In:</font></td>
					 <td width="25%"><p><font class="NArialL">
						<html:text name="lotChangeForm" property="prevDateIn" styleClass="valuetxfield" size="20" disabled="true"/>
					 </font></p></td>
				</tr>
				<tr>
					 <td colspan ="2" width="40%"><font class="NArialL">Add/Overide/Ignore Inventory:</font></td>
					 <td colspan ="2" align="left" width="50%">
                            <html:select property="existingInventory" styleClass="txfield" >
                                <html:option value="1">Add to existing</html:option>
                                <html:option value="2">Over Ride</html:option>
								<html:option value="3">Ignore</html:option>
                            </html:select>
					 </td>
				</tr>
				<tr>
					<td colspan=4>&nbsp;</td>
				</tr>
				</logic:equal>
--%>
				<tr>
					<td colspan=4>&nbsp;</td>
				</tr>
				<tr>
                    <td align=center colspan=4>
                        <chiptrack:restrictedLink functionality='<%=Functionality.LOT_CORRECTION%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:save();' onmouseover="window.status='Click to Save Lot Data';return true" onmouseout="window.status='';return true">
                            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" title='Click here to Save Lot Data'/>
                        </chiptrack:restrictedLink>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="<%=chipTracContext%>/lotChange.do?type=<%=type%>"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17" onmouseover="window.status='Click to Cancel Changes';return true" onmouseout="window.status='';return true" title="Click here to Cancel Changes"></a>
                    </td>
                </tr>
				</logic:notPresent>
				</logic:present>
			</table>
		</td>
	</tr>
</table>
</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>